import java.io.File;

public class RenameDemo03 {
    public static void main(String[] args) {
        String path = "F:\\IdeaProjects\\MyJava230203\\day28\\dir\\movie";
        File file = new File(path);// 创建抽象的File对象
        File[] files = file.listFiles();// 拿到目录的所有文件 [三体.avi,即日快乐.明日快乐.avi]
        for (File f : files) {
//            三体.avi
            String name = f.getName();
            System.out.println(name);
            String type = name.substring(name.lastIndexOf("."));
            System.out.println(type);
            String movie_name = name.substring(0, name.lastIndexOf("."));
            System.out.println(movie_name);
            String path1 = f.getParent();// 父路径
            System.out.println(path1);
            System.out.println(path1 + File.separator + movie_name + "_典藏版" + type);
            f.renameTo(new File(path1 + File.separator + movie_name + "_典藏版" + type));
        }

    }
}
